package com.ywb.controller;


import com.ywb.pojo.JobOption;
import com.ywb.pojo.Result;
import com.ywb.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;

    @GetMapping("/empJobData")
    public Result getEmpJobData(){
        log.info("统计员工人数");
        JobOption jobOption = reportService.getEmpJobData();
        return Result.success(jobOption);
    }

    @GetMapping("/empGenderData")
    public Result getEmpGenderData(){
        log.info("统计员工性别");
        List<Map<String,Object>>genderList = reportService.getEmpGenderData();
        return Result.success(genderList);
    }
    @GetMapping("/continentTradeData")
    public Result getContinentTradeData(){
        log.info("统计交易量");
        JobOption continentTradeList = reportService.getContinentTradeData();
        return Result.success(continentTradeList);
    }
    @GetMapping("/typeData")
    public Result getTypeData(){
        log.info("统计交易类型");
        List<Map<String,Object>>typeList = reportService.getTypeData();
        return Result.success(typeList);
    }
    @GetMapping("/inTradeData")
    public Result getInTradeData(){
        log.info("统计收入");
        JobOption inTradeList = reportService.getInTradeData();
        return Result.success(inTradeList);
    }
    @GetMapping("/outTradeData")
    public Result getOutTradeData(){
        log.info("统计收入");
        JobOption outTradeList = reportService.getOutTradeData();
        return Result.success(outTradeList);
    }

    @GetMapping("/commodityData")
    public Result getCommodityData(){
        log.info("统计商品");
        JobOption commodityList = reportService.getCommodityData();
        return Result.success(commodityList);
    }

    @GetMapping("/inCTData")
    public Result getInCTData(){
        log.info("统计国家收入");
        JobOption inCTList = reportService.getInCTData();
        return Result.success(inCTList);
    }

    @GetMapping("/outCTData")
    public Result getOutCTData(){
        log.info("统计国家支出");
        JobOption outCTList = reportService.getOutCTData();
        return Result.success(outCTList);
    }
    @GetMapping("/caNData")
    public Result getCaNData(){
        log.info("统计类别");
        List<Map<String,Object>> caNList = reportService.getCaNData();
        return Result.success(caNList);
    }

}
